package net;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;

public class Seversocket {
	public static void main(String[] args) throws IOException {
		test();
	}

	private static void test() throws IOException {
		new Thread(){
			public void run() {
				
			}
		}.start();
		ServerSocket ss = new ServerSocket(8000);
		Socket s = ss.accept();
		InputStream in = s.getInputStream();
		BufferedReader bin = new BufferedReader(new InputStreamReader(in));
		PrintWriter out = new PrintWriter(new OutputStreamWriter(s
				.getOutputStream()));
		while(true){
//			String line = JOptionPane.showInputDialog("");
//			out.println(line);
//			out.flush();
			
			String echo = bin.readLine();
			System.out.println(echo);
		}
//		String line;
//		while ((line = bin.readLine()) != null) {
//			System.out.println(line);
//			out.println(line);
//			out.flush();
//		}
//		s.close();
//		ss.close();
//		out.close();
	}
}
